CREATE TABLE `k_freight_space` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `position` varchar(45) DEFAULT NULL COMMENT '仓位编码',
    `warehouse` varchar(45) DEFAULT NULL COMMENT '仓库',
    `seat` varchar(45) DEFAULT NULL COMMENT '货位',
    `name` varchar(45) DEFAULT NULL COMMENT '名称',
    `remark` varchar(255) DEFAULT NULL COMMENT '备注',
    `enabled` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用',
    `user_id` int NOT NULL COMMENT '创建者',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `position_key` (`position`)
  ) ENGINE=InnoDB AUTO_INCREMENT=768 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='仓位表';

  ALTER TABLE k_freight_space  DROP COLUMN warehouse;
  ALTER TABLE k_freight_space  DROP COLUMN seat;
  ALTER TABLE `k_freight_space` ADD COLUMN `area` varchar(45) DEFAULT NULL COMMENT '区号';


  CREATE TABLE `k_vendor` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `vendorName` varchar(45) DEFAULT NULL COMMENT '厂商名',
    `remark` varchar(255) DEFAULT NULL COMMENT '备注',
    `user_id` int NOT NULL COMMENT '创建者',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `vendorName_key` (`vendorName`)
  ) ENGINE=InnoDB AUTO_INCREMENT=768 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='厂商表';

  CREATE TABLE `k_parts_category` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `categoryName` varchar(45) DEFAULT NULL COMMENT '分类名称',
    `remark` varchar(255) DEFAULT NULL COMMENT '备注',
    `user_id` int NOT NULL COMMENT '创建者',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `categoryName_key` (`categoryName`)
  ) ENGINE=InnoDB AUTO_INCREMENT=768 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='配件类别表';

  CREATE TABLE `k_equipment` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `equipmentCode` varchar(45) DEFAULT NULL COMMENT '设备编码',
    `equipmentName` varchar(45) DEFAULT NULL COMMENT '设备名称',
    `brand` varchar(45) DEFAULT NULL COMMENT '品牌',
    `model` varchar(45) DEFAULT NULL COMMENT '规格型号',
    `location` varchar(255) DEFAULT NULL COMMENT '存放位置',
    `remark` varchar(255) DEFAULT NULL COMMENT '备注',
    `user_id` int NOT NULL COMMENT '创建者',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `equipmentCode_key` (`equipmentCode`)
  ) ENGINE=InnoDB AUTO_INCREMENT=768 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='设备档案表';

  CREATE TABLE `k_parts` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `partsCode` varchar(45) DEFAULT NULL COMMENT '配件编码',
    `partsName` varchar(45) DEFAULT NULL COMMENT '配件名称',
    `brand` varchar(45) DEFAULT NULL COMMENT '品牌',
    `model` varchar(45) DEFAULT NULL COMMENT '规格型号',
    `vendorId` int(10) NOT NULL COMMENT '供应商id',
    `categoryId` int(10) NOT NULL COMMENT '类别id',
    `source` tinyint(4) NOT NULL DEFAULT '1' COMMENT '配件来源(1自购,2租赁)',
    `remark` varchar(255) DEFAULT NULL COMMENT '备注',
    `isScrap` tinyint NOT NULL DEFAULT '1' COMMENT '报废状态',
    `new_product` tinyint(4) NOT NULL DEFAULT 1 COMMENT '新产品状态(1是新产品,2是已使用过)',
    `user_id` int NOT NULL COMMENT '创建者',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `partsCode_key` (`partsCode`)
  ) ENGINE=InnoDB AUTO_INCREMENT=768 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='配件档案表';

  CREATE TABLE `k_source` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(45) DEFAULT NULL COMMENT '来源名称',
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='来源名称表';

  INSERT INTO k_source (id, name) VALUES (1, '自购');
  INSERT INTO k_source (id, name) VALUES (2, '租赁');
  
  

  CREATE TABLE `k_parts_inventory` (
    `parts_id` int(10) NOT NULL COMMENT '配件k_parts.id',
    `fs_id` int(10) NOT NULL DEFAULT 0 COMMENT '仓位k_freight_space.id',
    `state` tinyint NOT NULL DEFAULT '1' COMMENT '使用状态',
    `state2` tinyint NOT NULL DEFAULT '0' COMMENT '使用状态2',
    `po_id` int(10) NOT NULL COMMENT '最新操作k_parts_operation.id',
    `user_id` int NOT NULL COMMENT '创建者',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`parts_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=768 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='配件库存表';

  CREATE TABLE `k_parts_operation` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `parts_id` int(10) NOT NULL COMMENT '配件k_parts.id',
    `fs_id` int(10) NOT NULL DEFAULT 0 COMMENT '仓位k_freight_space.id',
    `equipment_id` int(10) NOT NULL COMMENT '使用设备k_equipment.id',
    `repair_vendor_id` int(10) NOT NULL COMMENT '修磨厂商k_vendor.id',
    `description` varchar(255) DEFAULT NULL COMMENT '描述',
    `state` tinyint NOT NULL DEFAULT '1' COMMENT '操作类型',
    `user_id` int NOT NULL COMMENT '创建者',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=768 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='配件操作记录表';

  
  CREATE TABLE `k_first_audit_receive` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `parts_id` int(10) NOT NULL COMMENT '配件k_parts.id',
    `equipment_id` int(10) NOT NULL COMMENT '使用设备k_equipment.id',
    `user_id` int NOT NULL COMMENT '申请人',
    `audit_uid` int NOT NULL COMMENT '审核人',
    `audit_at` timestamp NULL DEFAULT NULL,
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `parts_id_key` (`parts_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=768 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='第一次领用审核记录表';


  CREATE TABLE `k_scrap_audit` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `parts_id` int(10) NOT NULL COMMENT '配件k_parts.id',
    `remark` varchar(255) DEFAULT NULL COMMENT '备注',
    `isConsent` tinyint NOT NULL DEFAULT '0' COMMENT '同意状态1是同意，2是拒绝',
    `user_id` int NOT NULL COMMENT '申请人',
    `audit_uid` int NOT NULL COMMENT '审核人',
    `audit_at` timestamp NULL DEFAULT NULL COMMENT '审核时间',
    `refuse_uid` int NOT NULL COMMENT '拒绝人',
    `refuse_at` timestamp NULL DEFAULT NULL COMMENT '拒绝时间',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `parts_id_key` (`parts_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=768 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='报废审核';

  CREATE TABLE `k_operation_state` (
    `id` int(10) NOT NULL COMMENT 'id',
    `description` varchar(255) DEFAULT NULL COMMENT '描述',
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=768 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='操作记录状态描述';

  ALTER TABLE `k_parts` ADD COLUMN `gi_code` varchar(45) COMMENT 'k_goods_info货品编码';
  ALTER TABLE `k_parts` ADD COLUMN `width` FLOAT COMMENT '锯片宽度';
  
  INSERT INTO k_operation_state
    (id,description)
    VALUES(1,'新品入库'),(2,'新品入库'),(3,'领用'),(4,'领用归还'),(5,'送修磨'),(6,'待修磨'),(7,'修磨归还'),(8,'调仓'),(9,'配件报废'),
    (10,'待报废'),(11,'拒绝报废'),(-1,'删除'),(12,'申请报废');

  INSERT INTO permissions
    (name,guard_name,created_at,updated_at,title,description)
    VALUES('parts receive_give_back','web',now(),now(),'配件领用归还','配件领用归还');

  INSERT INTO permissions
    (name,guard_name,created_at,updated_at,title,description)
    VALUES('parts management','web',now(),now(),'管理配件','管理配件');

  INSERT INTO permissions
    (name,guard_name,created_at,updated_at,title,description)
    VALUES('parts audit','web',now(),now(),'审核配件','审核配件');

  alter table kd_designer_demand_bidding add KEY `designer_demand_id__index` (`designer_demand_id`);
  alter table kd_designer_demand_bidding add KEY `designer_id__index` (`designer_id`);
 
    //新品入库
    public const STATE_NEW_PRODUCT = 1;
    //入库
    public const STATE_RUKU = 2;
    //领用
    public const STATE_RECEIVE = 3;
    //归还
    public const STATE_GIVE_BACK = 4;
    //修模
    public const STATE_OUT_REPAIR = 5;
    //设置需要修磨
    public const STATE_NEED_REPAIR = 6;
    //修模归还
    public const STATE_COME_BACK_REPAIR = 7;
    //调仓
    public const STATE_AMEND_POSITION = 8;
    //报废
    public const STATE_SCRAP = 9;
    //设置需要报废
    public const STATE_NEEDSCRAP = 10;
    //拒绝报废
    public const STATE_NOT_NEEDSCRAP = 11;
    //被删除
    public const STATE_DELETE = -1;

INSERT INTO `k_freight_space` (`position`, `name`, `area`) VALUES ('602-YXM-087', '602车间已修磨区87号仓位', '已修磨区'),('602-WXM-087', '602车间未修磨区87号仓位', '未修磨区'),('602-YXM-088', '602车间已修磨区88号仓位', '已修磨区'),('602-WXM-088', '602车间未修磨区88号仓位', '未修磨区'),('602-YXM-089', '602车间已修磨区89号仓位', '已修磨区'),('602-WXM-089', '602车间未修磨区89号仓位', '未修磨区'),('602-YXM-090', '602车间已修磨区90号仓位', '已修磨区'),('602-WXM-090', '602车间未修磨区90号仓位', '未修磨区'),('602-YXM-091', '602车间已修磨区91号仓位', '已修磨区'),('602-WXM-091', '602车间未修磨区91号仓位', '未修磨区'),('602-YXM-092', '602车间已修磨区92号仓位', '已修磨区'),('602-WXM-092', '602车间未修磨区92号仓位', '未修磨区'),('602-YXM-093', '602车间已修磨区93号仓位', '已修磨区'),('602-WXM-093', '602车间未修磨区93号仓位', '未修磨区'),('602-YXM-094', '602车间已修磨区94号仓位', '已修磨区'),('602-WXM-094', '602车间未修磨区94号仓位', '未修磨区'),('602-YXM-095', '602车间已修磨区95号仓位', '已修磨区'),('602-WXM-095', '602车间未修磨区95号仓位', '未修磨区'),('602-YXM-096', '602车间已修磨区96号仓位', '已修磨区'),('602-WXM-096', '602车间未修磨区96号仓位', '未修磨区'),('602-YXM-097', '602车间已修磨区97号仓位', '已修磨区'),('602-WXM-097', '602车间未修磨区97号仓位', '未修磨区'),('602-YXM-098', '602车间已修磨区98号仓位', '已修磨区'),('602-WXM-098', '602车间未修磨区98号仓位', '未修磨区'),('602-YXM-099', '602车间已修磨区99号仓位', '已修磨区'),('602-WXM-099', '602车间未修磨区99号仓位', '未修磨区'),('602-YXM-100', '602车间已修磨区100号仓位', '已修磨区'),('602-WXM-100', '602车间未修磨区100号仓位', '未修磨区'),('602-YXM-101', '602车间已修磨区101号仓位', '已修磨区'),('602-WXM-101', '602车间未修磨区101号仓位', '未修磨区'),('602-YXM-102', '602车间已修磨区102号仓位', '已修磨区'),('602-WXM-102', '602车间未修磨区102号仓位', '未修磨区'),('602-YXM-103', '602车间已修磨区103号仓位', '已修磨区'),('602-WXM-103', '602车间未修磨区103号仓位', '未修磨区'),('602-YXM-104', '602车间已修磨区104号仓位', '已修磨区'),('602-WXM-104', '602车间未修磨区104号仓位', '未修磨区'),('602-YXM-105', '602车间已修磨区105号仓位', '已修磨区'),('602-WXM-105', '602车间未修磨区105号仓位', '未修磨区'),('602-YXM-106', '602车间已修磨区106号仓位', '已修磨区'),('602-WXM-106', '602车间未修磨区106号仓位', '未修磨区'),('602-YXM-107', '602车间已修磨区107号仓位', '已修磨区'),('602-WXM-107', '602车间未修磨区107号仓位', '未修磨区'),('602-YXM-108', '602车间已修磨区108号仓位', '已修磨区'),('602-WXM-108', '602车间未修磨区108号仓位', '未修磨区'),('602-YXM-109', '602车间已修磨区109号仓位', '已修磨区'),('602-WXM-109', '602车间未修磨区109号仓位', '未修磨区'),('602-YXM-110', '602车间已修磨区110号仓位', '已修磨区'),('602-WXM-110', '602车间未修磨区110号仓位', '未修磨区'),('602-YXM-111', '602车间已修磨区111号仓位', '已修磨区'),('602-WXM-111', '602车间未修磨区111号仓位', '未修磨区'),('602-YXM-112', '602车间已修磨区112号仓位', '已修磨区'),('602-WXM-112', '602车间未修磨区112号仓位', '未修磨区'),('602-YXM-113', '602车间已修磨区113号仓位', '已修磨区'),('602-WXM-113', '602车间未修磨区113号仓位', '未修磨区'),('602-YXM-114', '602车间已修磨区114号仓位', '已修磨区'),('602-WXM-114', '602车间未修磨区114号仓位', '未修磨区'),('602-YXM-115', '602车间已修磨区115号仓位', '已修磨区'),('602-WXM-115', '602车间未修磨区115号仓位', '未修磨区'),('602-YXM-116', '602车间已修磨区116号仓位', '已修磨区'),('602-WXM-116', '602车间未修磨区116号仓位', '未修磨区'),('602-YXM-117', '602车间已修磨区117号仓位', '已修磨区'),('602-WXM-117', '602车间未修磨区117号仓位', '未修磨区'),('602-YXM-118', '602车间已修磨区118号仓位', '已修磨区'),('602-WXM-118', '602车间未修磨区118号仓位', '未修磨区'),('602-YXM-119', '602车间已修磨区119号仓位', '已修磨区'),('602-WXM-119', '602车间未修磨区119号仓位', '未修磨区'),('602-YXM-120', '602车间已修磨区120号仓位', '已修磨区'),('602-WXM-120', '602车间未修磨区120号仓位', '未修磨区'),('602-YXM-121', '602车间已修磨区121号仓位', '已修磨区'),('602-WXM-121', '602车间未修磨区121号仓位', '未修磨区'),('602-YXM-122', '602车间已修磨区122号仓位', '已修磨区'),('602-WXM-122', '602车间未修磨区122号仓位', '未修磨区'),('602-YXM-123', '602车间已修磨区123号仓位', '已修磨区'),('602-WXM-123', '602车间未修磨区123号仓位', '未修磨区'),('602-YXM-124', '602车间已修磨区124号仓位', '已修磨区'),('602-WXM-124', '602车间未修磨区124号仓位', '未修磨区'),('602-YXM-125', '602车间已修磨区125号仓位', '已修磨区'),('602-WXM-125', '602车间未修磨区125号仓位', '未修磨区'),('602-YXM-126', '602车间已修磨区126号仓位', '已修磨区'),('602-WXM-126', '602车间未修磨区126号仓位', '未修磨区'),('602-YXM-127', '602车间已修磨区127号仓位', '已修磨区'),('602-WXM-127', '602车间未修磨区127号仓位', '未修磨区'),('602-YXM-128', '602车间已修磨区128号仓位', '已修磨区'),('602-WXM-128', '602车间未修磨区128号仓位', '未修磨区'),('602-YXM-129', '602车间已修磨区129号仓位', '已修磨区'),('602-WXM-129', '602车间未修磨区129号仓位', '未修磨区'),('602-YXM-130', '602车间已修磨区130号仓位', '已修磨区'),('602-WXM-130', '602车间未修磨区130号仓位', '未修磨区'),('602-YXM-131', '602车间已修磨区131号仓位', '已修磨区'),('602-WXM-131', '602车间未修磨区131号仓位', '未修磨区'),('602-YXM-132', '602车间已修磨区132号仓位', '已修磨区');

INSERT INTO `k_freight_space` (`position`, `name`, `area`) VALUES ('602-WXM-135', '602车间未修磨区135号仓位', '未修磨区'),('602-YXM-136', '602车间已修磨区136号仓位', '已修磨区'),('602-WXM-136', '602车间未修磨区136号仓位', '未修磨区'),('602-YXM-137', '602车间已修磨区137号仓位', '已修磨区'),('602-WXM-137', '602车间未修磨区137号仓位', '未修磨区'),('602-YXM-138', '602车间已修磨区138号仓位', '已修磨区'),('602-WXM-138', '602车间未修磨区138号仓位', '未修磨区'),('602-YXM-139', '602车间已修磨区139号仓位', '已修磨区'),('602-WXM-139', '602车间未修磨区139号仓位', '未修磨区'),('602-YXM-140', '602车间已修磨区140号仓位', '已修磨区'),('602-WXM-140', '602车间未修磨区140号仓位', '未修磨区'),('602-YXM-141', '602车间已修磨区141号仓位', '已修磨区'),('602-WXM-141', '602车间未修磨区141号仓位', '未修磨区'),('602-YXM-142', '602车间已修磨区142号仓位', '已修磨区'),('602-WXM-142', '602车间未修磨区142号仓位', '未修磨区'),('602-YXM-143', '602车间已修磨区143号仓位', '已修磨区'),('602-WXM-143', '602车间未修磨区143号仓位', '未修磨区'),('602-YXM-144', '602车间已修磨区144号仓位', '已修磨区'),('602-WXM-144', '602车间未修磨区144号仓位', '未修磨区'),('602-YXM-145', '602车间已修磨区145号仓位', '已修磨区'),('602-WXM-145', '602车间未修磨区145号仓位', '未修磨区'),('602-YXM-146', '602车间已修磨区146号仓位', '已修磨区'),('602-WXM-146', '602车间未修磨区146号仓位', '未修磨区'),('602-YXM-147', '602车间已修磨区147号仓位', '已修磨区'),('602-WXM-147', '602车间未修磨区147号仓位', '未修磨区'),('602-YXM-148', '602车间已修磨区148号仓位', '已修磨区'),('602-WXM-148', '602车间未修磨区148号仓位', '未修磨区'),('602-YXM-149', '602车间已修磨区149号仓位', '已修磨区'),('602-WXM-149', '602车间未修磨区149号仓位', '未修磨区'),('602-YXM-150', '602车间已修磨区150号仓位', '已修磨区'),('602-WXM-150', '602车间未修磨区150号仓位', '未修磨区'),('602-YXM-151', '602车间已修磨区151号仓位', '已修磨区'),('602-WXM-151', '602车间未修磨区151号仓位', '未修磨区'),('602-YXM-152', '602车间已修磨区152号仓位', '已修磨区');
 
INSERT INTO `k_freight_space` (`position`, `name`, `area`) VALUES ('602-YXM-153', '602车间已修磨区153号仓位', '已修磨区'),('602-YXM-154', '602车间已修磨区154号仓位', '已修磨区'),('602-YXM-155', '602车间已修磨区155号仓位', '已修磨区'),('602-YXM-156', '602车间已修磨区156号仓位', '已修磨区'),('602-YXM-157', '602车间已修磨区157号仓位', '已修磨区'),('602-YXM-158', '602车间已修磨区158号仓位', '已修磨区'),('602-YXM-159', '602车间已修磨区159号仓位', '已修磨区'),('602-YXM-160', '602车间已修磨区160号仓位', '已修磨区'),('602-YXM-161', '602车间已修磨区161号仓位', '已修磨区'),('602-YXM-162', '602车间已修磨区162号仓位', '已修磨区'),('602-YXM-163', '602车间已修磨区163号仓位', '已修磨区'),('602-YXM-164', '602车间已修磨区164号仓位', '已修磨区'),('602-YXM-165', '602车间已修磨区165号仓位', '已修磨区'),('602-YXM-166', '602车间已修磨区166号仓位', '已修磨区'),('602-YXM-167', '602车间已修磨区167号仓位', '已修磨区'),('602-YXM-168', '602车间已修磨区168号仓位', '已修磨区'),('602-YXM-169', '602车间已修磨区169号仓位', '已修磨区'),('602-YXM-170', '602车间已修磨区170号仓位', '已修磨区'),('602-YXM-171', '602车间已修磨区171号仓位', '已修磨区'),('602-YXM-172', '602车间已修磨区172号仓位', '已修磨区'),('602-YXM-173', '602车间已修磨区173号仓位', '已修磨区'),('602-YXM-174', '602车间已修磨区174号仓位', '已修磨区'),('602-YXM-175', '602车间已修磨区175号仓位', '已修磨区'),('602-YXM-176', '602车间已修磨区176号仓位', '已修磨区'),('602-YXM-177', '602车间已修磨区177号仓位', '已修磨区'),('602-YXM-178', '602车间已修磨区178号仓位', '已修磨区'),('602-YXM-179', '602车间已修磨区179号仓位', '已修磨区'),('602-YXM-180', '602车间已修磨区180号仓位', '已修磨区'),('602-YXM-181', '602车间已修磨区181号仓位', '已修磨区'),('602-YXM-182', '602车间已修磨区182号仓位', '已修磨区'),('602-YXM-183', '602车间已修磨区183号仓位', '已修磨区'),('602-YXM-184', '602车间已修磨区184号仓位', '已修磨区'),('602-YXM-185', '602车间已修磨区185号仓位', '已修磨区'),('602-YXM-186', '602车间已修磨区186号仓位', '已修磨区'),('602-YXM-187', '602车间已修磨区187号仓位', '已修磨区'),('602-YXM-188', '602车间已修磨区188号仓位', '已修磨区'),('602-YXM-189', '602车间已修磨区189号仓位', '已修磨区'),('602-YXM-190', '602车间已修磨区190号仓位', '已修磨区'),('602-YXM-191', '602车间已修磨区191号仓位', '已修磨区'),('602-YXM-192', '602车间已修磨区192号仓位', '已修磨区'),('602-YXM-193', '602车间已修磨区193号仓位', '已修磨区'),('602-YXM-194', '602车间已修磨区194号仓位', '已修磨区'),('602-YXM-195', '602车间已修磨区195号仓位', '已修磨区'),('602-YXM-196', '602车间已修磨区196号仓位', '已修磨区'),('602-YXM-197', '602车间已修磨区197号仓位', '已修磨区'),('602-YXM-198', '602车间已修磨区198号仓位', '已修磨区'),('602-YXM-199', '602车间已修磨区199号仓位', '已修磨区'),('602-YXM-200', '602车间已修磨区200号仓位', '已修磨区'),('602-YXM-201', '602车间已修磨区201号仓位', '已修磨区'),('602-YXM-202', '602车间已修磨区202号仓位', '已修磨区'),('602-YXM-203', '602车间已修磨区203号仓位', '已修磨区'),('602-YXM-204', '602车间已修磨区204号仓位', '已修磨区'),('602-YXM-205', '602车间已修磨区205号仓位', '已修磨区'),('602-YXM-206', '602车间已修磨区206号仓位', '已修磨区'),('602-YXM-207', '602车间已修磨区207号仓位', '已修磨区'),('602-YXM-208', '602车间已修磨区208号仓位', '已修磨区'),('602-YXM-209', '602车间已修磨区209号仓位', '已修磨区'),('602-YXM-210', '602车间已修磨区210号仓位', '已修磨区'),('602-YXM-211', '602车间已修磨区211号仓位', '已修磨区'),('602-YXM-212', '602车间已修磨区212号仓位', '已修磨区'),('602-YXM-213', '602车间已修磨区213号仓位', '已修磨区'),('602-YXM-214', '602车间已修磨区214号仓位', '已修磨区'),('602-YXM-215', '602车间已修磨区215号仓位', '已修磨区'),('602-YXM-216', '602车间已修磨区216号仓位', '已修磨区'),('602-YXM-217', '602车间已修磨区217号仓位', '已修磨区'),('602-YXM-218', '602车间已修磨区218号仓位', '已修磨区'),('602-YXM-219', '602车间已修磨区219号仓位', '已修磨区'),('602-YXM-220', '602车间已修磨区220号仓位', '已修磨区'),('602-YXM-221', '602车间已修磨区221号仓位', '已修磨区'),('602-YXM-222', '602车间已修磨区222号仓位', '已修磨区'),('602-YXM-223', '602车间已修磨区223号仓位', '已修磨区'),('602-YXM-224', '602车间已修磨区224号仓位', '已修磨区'),('602-YXM-225', '602车间已修磨区225号仓位', '已修磨区'),('602-YXM-226', '602车间已修磨区226号仓位', '已修磨区'),('602-YXM-227', '602车间已修磨区227号仓位', '已修磨区'),('602-YXM-228', '602车间已修磨区228号仓位', '已修磨区'),('602-YXM-229', '602车间已修磨区229号仓位', '已修磨区'),('602-YXM-230', '602车间已修磨区230号仓位', '已修磨区'),('602-YXM-231', '602车间已修磨区231号仓位', '已修磨区'),('602-YXM-232', '602车间已修磨区232号仓位', '已修磨区'),('602-YXM-233', '602车间已修磨区233号仓位', '已修磨区'),('602-YXM-234', '602车间已修磨区234号仓位', '已修磨区'),('602-YXM-235', '602车间已修磨区235号仓位', '已修磨区'),('602-YXM-236', '602车间已修磨区236号仓位', '已修磨区'),('602-YXM-237', '602车间已修磨区237号仓位', '已修磨区'),('602-YXM-238', '602车间已修磨区238号仓位', '已修磨区'),('602-YXM-239', '602车间已修磨区239号仓位', '已修磨区'),('602-YXM-240', '602车间已修磨区240号仓位', '已修磨区'),('602-YXM-241', '602车间已修磨区241号仓位', '已修磨区'),('602-YXM-242', '602车间已修磨区242号仓位', '已修磨区'),('602-YXM-243', '602车间已修磨区243号仓位', '已修磨区'),('602-YXM-244', '602车间已修磨区244号仓位', '已修磨区'),
('602-YXM-245', '602车间已修磨区245号仓位', '已修磨区'),
('602-YXM-246', '602车间已修磨区246号仓位', '已修磨区'),
('602-YXM-247', '602车间已修磨区247号仓位', '已修磨区'),
('602-YXM-248', '602车间已修磨区248号仓位', '已修磨区'),
('602-YXM-249', '602车间已修磨区249号仓位', '已修磨区'),
('602-YXM-250', '602车间已修磨区250号仓位', '已修磨区'),
('602-YXM-251', '602车间已修磨区251号仓位', '已修磨区'),
('602-YXM-252', '602车间已修磨区252号仓位', '已修磨区'),
('602-YXM-253', '602车间已修磨区253号仓位', '已修磨区');

INSERT INTO `k_freight_space` (`position`, `name`, `area`) VALUES ('602-YXM-254', '602车间已修磨区254号仓位', '已修磨区'),('602-YXM-255', '602车间已修磨区255号仓位', '已修磨区'),('602-YXM-256', '602车间已修磨区256号仓位', '已修磨区'),('602-YXM-257', '602车间已修磨区257号仓位', '已修磨区'),('602-YXM-258', '602车间已修磨区258号仓位', '已修磨区'),('602-YXM-259', '602车间已修磨区259号仓位', '已修磨区'),('602-YXM-260', '602车间已修磨区260号仓位', '已修磨区'),('602-YXM-261', '602车间已修磨区261号仓位', '已修磨区'),('602-YXM-262', '602车间已修磨区262号仓位', '已修磨区'),('602-YXM-263', '602车间已修磨区263号仓位', '已修磨区'),('602-YXM-264', '602车间已修磨区264号仓位', '已修磨区'),('602-YXM-265', '602车间已修磨区265号仓位', '已修磨区'),('602-YXM-266', '602车间已修磨区266号仓位', '已修磨区'),('602-YXM-267', '602车间已修磨区267号仓位', '已修磨区'),('602-YXM-268', '602车间已修磨区268号仓位', '已修磨区'),('602-YXM-269', '602车间已修磨区269号仓位', '已修磨区'),('602-YXM-270', '602车间已修磨区270号仓位', '已修磨区'),('602-YXM-271', '602车间已修磨区271号仓位', '已修磨区'),('602-YXM-272', '602车间已修磨区272号仓位', '已修磨区'),('602-YXM-273', '602车间已修磨区273号仓位', '已修磨区'),('602-YXM-274', '602车间已修磨区274号仓位', '已修磨区'),('602-YXM-275', '602车间已修磨区275号仓位', '已修磨区'),('602-YXM-276', '602车间已修磨区276号仓位', '已修磨区'),('602-YXM-277', '602车间已修磨区277号仓位', '已修磨区'),('602-YXM-278', '602车间已修磨区278号仓位', '已修磨区'),('602-YXM-279', '602车间已修磨区279号仓位', '已修磨区'),('602-YXM-280', '602车间已修磨区280号仓位', '已修磨区'),('602-YXM-281', '602车间已修磨区281号仓位', '已修磨区'),('602-YXM-282', '602车间已修磨区282号仓位', '已修磨区'),('602-YXM-283', '602车间已修磨区283号仓位', '已修磨区'),('602-YXM-284', '602车间已修磨区284号仓位', '已修磨区'),('602-YXM-285', '602车间已修磨区285号仓位', '已修磨区'),('602-YXM-286', '602车间已修磨区286号仓位', '已修磨区'),('602-YXM-287', '602车间已修磨区287号仓位', '已修磨区'),('602-YXM-288', '602车间已修磨区288号仓位', '已修磨区'),('602-YXM-289', '602车间已修磨区289号仓位', '已修磨区'),('602-YXM-290', '602车间已修磨区290号仓位', '已修磨区'),('602-YXM-291', '602车间已修磨区291号仓位', '已修磨区'),('602-YXM-292', '602车间已修磨区292号仓位', '已修磨区'),('602-YXM-293', '602车间已修磨区293号仓位', '已修磨区'),('602-YXM-294', '602车间已修磨区294号仓位', '已修磨区'),('602-YXM-295', '602车间已修磨区295号仓位', '已修磨区'),('602-YXM-296', '602车间已修磨区296号仓位', '已修磨区'),('602-YXM-297', '602车间已修磨区297号仓位', '已修磨区'),('602-YXM-298', '602车间已修磨区298号仓位', '已修磨区'),('602-YXM-299', '602车间已修磨区299号仓位', '已修磨区'),('602-YXM-300', '602车间已修磨区300号仓位', '已修磨区');

INSERT INTO `k_freight_space` (`position`, `name`, `area`) VALUES ('602-YXM-302', '602车间已修磨区302号仓位', '已修磨区'),('602-YXM-303', '602车间已修磨区303号仓位', '已修磨区'),('602-YXM-304', '602车间已修磨区304号仓位', '已修磨区'),('602-YXM-305', '602车间已修磨区305号仓位', '已修磨区'),('602-YXM-306', '602车间已修磨区306号仓位', '已修磨区'),('602-YXM-307', '602车间已修磨区307号仓位', '已修磨区'),('602-YXM-308', '602车间已修磨区308号仓位', '已修磨区'),('602-YXM-309', '602车间已修磨区309号仓位', '已修磨区'),('602-YXM-310', '602车间已修磨区310号仓位', '已修磨区'),('602-YXM-311', '602车间已修磨区311号仓位', '已修磨区'),('602-YXM-312', '602车间已修磨区312号仓位', '已修磨区'),('602-YXM-313', '602车间已修磨区313号仓位', '已修磨区'),('602-YXM-314', '602车间已修磨区314号仓位', '已修磨区'),('602-YXM-315', '602车间已修磨区315号仓位', '已修磨区'),('602-YXM-316', '602车间已修磨区316号仓位', '已修磨区'),('602-YXM-317', '602车间已修磨区317号仓位', '已修磨区'),('602-YXM-318', '602车间已修磨区318号仓位', '已修磨区'),('602-YXM-319', '602车间已修磨区319号仓位', '已修磨区'),('602-YXM-320', '602车间已修磨区320号仓位', '已修磨区'),('602-YXM-321', '602车间已修磨区321号仓位', '已修磨区'),('602-YXM-322', '602车间已修磨区322号仓位', '已修磨区'),('602-YXM-323', '602车间已修磨区323号仓位', '已修磨区'),('602-YXM-324', '602车间已修磨区324号仓位', '已修磨区'),('602-YXM-325', '602车间已修磨区325号仓位', '已修磨区'),('602-YXM-326', '602车间已修磨区326号仓位', '已修磨区'),('602-YXM-327', '602车间已修磨区327号仓位', '已修磨区'),('602-YXM-328', '602车间已修磨区328号仓位', '已修磨区'),('602-YXM-329', '602车间已修磨区329号仓位', '已修磨区'),('602-YXM-330', '602车间已修磨区330号仓位', '已修磨区'),('602-YXM-331', '602车间已修磨区331号仓位', '已修磨区'),('602-YXM-332', '602车间已修磨区332号仓位', '已修磨区'),('602-YXM-333', '602车间已修磨区333号仓位', '已修磨区'),('602-YXM-334', '602车间已修磨区334号仓位', '已修磨区'),('602-YXM-335', '602车间已修磨区335号仓位', '已修磨区'),('602-YXM-336', '602车间已修磨区336号仓位', '已修磨区'),('602-YXM-337', '602车间已修磨区337号仓位', '已修磨区'),('602-YXM-338', '602车间已修磨区338号仓位', '已修磨区'),('602-YXM-339', '602车间已修磨区339号仓位', '已修磨区'),('602-YXM-340', '602车间已修磨区340号仓位', '已修磨区'),('602-YXM-341', '602车间已修磨区341号仓位', '已修磨区'),('602-YXM-342', '602车间已修磨区342号仓位', '已修磨区'),('602-YXM-343', '602车间已修磨区343号仓位', '已修磨区'),('602-YXM-344', '602车间已修磨区344号仓位', '已修磨区'),('602-YXM-345', '602车间已修磨区345号仓位', '已修磨区'),('602-YXM-346', '602车间已修磨区346号仓位', '已修磨区'),('602-YXM-347', '602车间已修磨区347号仓位', '已修磨区'),('602-YXM-348', '602车间已修磨区348号仓位', '已修磨区'),('602-YXM-349', '602车间已修磨区349号仓位', '已修磨区'),('602-YXM-350', '602车间已修磨区350号仓位', '已修磨区'),('602-YXM-351', '602车间已修磨区351号仓位', '已修磨区'),('602-YXM-352', '602车间已修磨区352号仓位', '已修磨区'),('602-YXM-353', '602车间已修磨区353号仓位', '已修磨区'),('602-YXM-354', '602车间已修磨区354号仓位', '已修磨区'),('602-YXM-355', '602车间已修磨区355号仓位', '已修磨区'),('602-YXM-356', '602车间已修磨区356号仓位', '已修磨区'),('602-YXM-357', '602车间已修磨区357号仓位', '已修磨区'),('602-YXM-358', '602车间已修磨区358号仓位', '已修磨区'),('602-YXM-359', '602车间已修磨区359号仓位', '已修磨区'),('602-YXM-360', '602车间已修磨区360号仓位', '已修磨区'),('602-YXM-361', '602车间已修磨区361号仓位', '已修磨区'),('602-YXM-362', '602车间已修磨区362号仓位', '已修磨区'),('602-YXM-363', '602车间已修磨区363号仓位', '已修磨区'),('602-YXM-364', '602车间已修磨区364号仓位', '已修磨区'),('602-YXM-365', '602车间已修磨区365号仓位', '已修磨区'),('602-YXM-366', '602车间已修磨区366号仓位', '已修磨区'),('602-YXM-367', '602车间已修磨区367号仓位', '已修磨区'),('602-YXM-368', '602车间已修磨区368号仓位', '已修磨区');

INSERT INTO `k_freight_space` (`position`, `name`, `area`) VALUES ('602-YXM-301', '602车间已修磨区301号仓位', '已修磨区');


ALTER TABLE `kd_manuals` ADD `cover2` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '封面2';



INSERT INTO `knybi_area_task` (`area_id`, `task_year`, `task_month`,`task_amount`) 
VALUES
('12', '2024', '1','800000.00'),
('12', '2024', '2','600000.00'),
('12', '2024', '3','1400000.00'),
('12', '2024', '4','1600000.00'),
('12', '2024', '5','1700000.00'),
('12', '2024', '6','1900000.00'),
('12', '2024', '7','1900000.00'),
('12', '2024', '8','2000000.00'),
('12', '2024', '9','2100000.00'),
('12', '2024', '10','1900000.00'),
('12', '2024', '11','2100000.00'),
('12', '2024', '12','2000000.00');

UPDATE knybi_area_task SET flag = '1' WHERE area_id = '12' AND task_year = '2024';


CREATE TABLE `kd_jumofang_course_style` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL COMMENT '创建者',
  `title` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '标题',
  `sort` int NOT NULL COMMENT '排序',
  `is_show` tinyint NOT NULL COMMENT '1显示,-1隐藏',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=134 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='居魔方学习课程类型';

CREATE TABLE `kd_jumofang_course` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL COMMENT '创建者',
  `title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '标题',
  `thumb` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '封面图片',
  `video_uri` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '视频链接',
  `sort` int NOT NULL COMMENT '排序',
  `style_id` int NOT NULL DEFAULT '0' COMMENT 'kd_course_style.id',
  `is_show` tinyint NOT NULL COMMENT '1显示,-1隐藏',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `style_id_key` (`style_id`)
) ENGINE=InnoDB AUTO_INCREMENT=124 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='居魔方学习课程';



CREATE TABLE `kd_jumofang_course_question` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL COMMENT '创建人',
  `question_text` text COLLATE utf8mb4_unicode_ci COMMENT '试卷内容',
  `type` tinyint NOT NULL COMMENT '1，单选题；2，多选题；3，判断题；',
  `style_id` int NOT NULL DEFAULT '0' COMMENT 'kd_course_style.id',
  `is_show` tinyint NOT NULL COMMENT '1显示,-1隐藏',
  `sort` int NOT NULL COMMENT '排序',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=132 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='学习课程问卷';

CREATE TABLE `kd_jumofang_course_options` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `question_id` int NOT NULL COMMENT '题目kd_course_question.id',
  `is_answer` tinyint NOT NULL DEFAULT '2' COMMENT '1是答案,2不是答案',
  `option` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '题目选项内容',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `question_id_index` (`question_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1565 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='题目选项表';

CREATE TABLE `kd_jumofang_course_paper_record` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL COMMENT '创建人',
  `style_id` int NOT NULL COMMENT '课程类型kd_jumofang_course_style.id',
  `grade` int NOT NULL COMMENT '分数',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `year_month` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '记录的年月',
  PRIMARY KEY (`id`),
  KEY `style_id_key` (`style_id`)
) ENGINE=InnoDB AUTO_INCREMENT=114 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='学习课程考试分数';

drop table kd_jumofang_course_record;
CREATE TABLE `kd_jumofang_course_record` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL COMMENT '观看人',
  `course_id` int NOT NULL COMMENT '观看的课程',
  `year_month` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '记录的年月',
  `day` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '记录的日期',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `course_id_key` (`course_id`)
) ENGINE=InnoDB AUTO_INCREMENT=114 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='学习课程记录';
alter table `kd_jumofang_course` ADD COLUMN `is_recommend` tinyint NOT NULL COMMENT '1推荐，-1不推荐';

alter table `kd_banners` ADD COLUMN `type` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '轮播图类型';

alter table `kd_jumofang_course_style` ADD COLUMN `second` int NOT NULL DEFAULT '0'  COMMENT '考试时间';

alter table `kd_jumofang_course_question` ADD COLUMN `img` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '附带图片';